package com.dingding.dubbo.provider;

import com.dingding.dubbo.framework.Protocol;
import com.dingding.dubbo.framework.ProtocolFactory;
import com.dingding.dubbo.framework.URL;
import com.dingding.dubbo.framework.register.LocalRegister;
import com.dingding.dubbo.framework.register.RemoteRegister;
import com.dingding.dubbo.provider.api.HelloService;
import com.dingding.dubbo.provider.impl.HelloServiceImpl;

/**
 * @program: spring-learning
 * @description:
 * @author: liugongding
 * @create: 2022-01-13 16:15
 **/
public class Provider {

    public static void main(String[] args) {

        //服务注册
        LocalRegister.regist(HelloService.class.getName(), HelloServiceImpl.class);
        URL url = new URL("localhost", 8080);
        RemoteRegister.regist(HelloService.class.getName(), url);

//        HttpServer httpServer = new HttpServer();
//        httpServer.start(url.getHostname(), url.getPort());

//        NettyServer nettyServer = new NettyServer();
//        nettyServer.start(url.getHostname(), url.getPort());

        Protocol protocol = ProtocolFactory.getProtocol();
        protocol.start(url);
    }
}
